package com.sp.scmdb.action;

import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import com.sp.scmdb.bean.LogBean;
import com.sp.scmdb.common.action.BaseAction;
import com.sp.scmdb.entity.User;
import com.sp.scmdb.service.LogService;
import com.sp.scmdb.service.UserService;


@Controller("logAction")
@Scope("prototype")
public class LogAction extends BaseAction<LogBean> {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private LogService logService;
	
	private UserService userService;

	/**
	 * @param userService the userService to set
	 */
	@Autowired
	public void setUserService(UserService userService) {
		this.userService = userService;
	}


	@Autowired
	public void setLogService(LogService logService) {
		this.logService = logService;
	}
	
	@SuppressWarnings("unchecked")
	public String findAll() {
		List<User> userList = userService.queryAllUser();
		session.put("userList", userList);
		LogBean logBean = null;
		if (StringUtils.isNotEmpty(pageName)) {
			logBean = (LogBean) session.get("logBean");
		}else{
			entity.setPageNo(1);
		}
		setEntity(logService.findAll(entity, logBean));
		session.put("logBean", entity);
		return SUCCESS;
	}
}
